package cn.iocoder.yudao.module.study.formatResult.constant;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author cjc
 * @Date 2024/5/17 18:00
 * @Description: 格式化的固定值
 * @Version 1.0
 */
public class FormatConstant {

    private final static String NOT_DEFINE = "未定义";

    public static String getValue(String type,String value){
        if (StringUtils.isBlank(type) || StringUtils.isBlank(value)){
            return null;
        }
        switch (type){
            case "system_user_sex":
                return getSex(value);
            case "id_card_type":
                return getIdCard(value);
            default:
                return "";
        }
    }


    private static String getSex(String type){
        Map<String,String> map = new HashMap<>(3);
        map.put("0","未知");
        map.put("1","男");
        map.put("2","女");
        return map.getOrDefault(type,NOT_DEFINE);
    }

    private static String getIdCard(String type){
        Map<String,String> map = new HashMap<>(3);
        map.put("01","居民身份证");
        map.put("02","港澳台居民居住证");
        map.put("03","港澳居民来往内地通行证");
        map.put("04","五年有效期台湾居民来往大陆通行证");
        map.put("05","其他");
        return map.getOrDefault(type,NOT_DEFINE);
    }

}
